<template>
    <div style="height: 100%">
        <a-row style="height: 100%">
            <a-col :span="18" style="height: 100%; overflow: auto">
                <a-row >
                    <a-col :span="20" :offset="2">
                        <a-row style="margin-top: 5%">
                            <a-tabs default-active-key="2" @change="changetab">
                                <a-tab-pane key="2" tab="历史记录">
                                    <QuestionTable :questionType=questionType />
                                </a-tab-pane>
                                <a-tab-pane key="3" tab="收藏夹">
                                    <QuestionTable :questionType=questionType />
                                </a-tab-pane>
                                <a-tab-pane key="1" tab="错题本">
                                    <QuestionTable :questionType=questionType />
                                </a-tab-pane>

                            </a-tabs>
                        </a-row>
                    </a-col>
                </a-row>
            </a-col>
            <a-col :span="6" style="height: 100%; overflow: auto; background-color: #99ccff; box-shadow: -1px 2px 10px 2px rgba(0,0,0,0.3)">
                <InfoBoard />
            </a-col>
        </a-row>
    </div>
</template>

<script>
    import InfoBoard from "@/components/content/student/InfoBoard";
    import QuestionTable from "@/components/content/student/QuestionTable";
    export default {
        name: "info",
        components:{
            InfoBoard,
            QuestionTable
        },
        data(){
            return{
                questionType:2
            }
        },
        mounted() {
            this.changetab(2);
        },
        methods:{
            changetab(type){
                this.questionType=Number(type);
                const questData= {
                    offset: 0,
                    limit: 8,
                    token:this.$store.state.login.token,
                    studentID:this.$store.state.login.student_id,
                    recordType:Number(type)
                };
                this.$store.dispatch('student/getRecordsList',questData).then(
                    res => {
                        if(res.code === 0){
                            this.$message.error(res.msg);
                        }
                    }).catch(()=>{
                    this.$message.error("网络异常")
                })
            }
        }
    }
</script>

<style scoped>

</style>